<%--
  Created by IntelliJ IDEA.
  User: 22954
  Date: 2024/9/1
  Time: 15:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page isELIgnored="false" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>El学习</title>
</head>
<%--El表达式为 ${key}  {}内可以为取值,运算,empty操作--%>
<body>
<%
    pageContext.setAttribute("k1", "pageContext");
    request.setAttribute("k1", "request");
    session.setAttribute("k1", "session");
    application.setAttribute("k1", "application");

    int[] arr = new int[5];
    for (int i = 0; i <5; i++) {
        arr[i] = i;
    }
    request.setAttribute("array", arr);
    request.setAttribute("null", "");
%>
<%--El表达式 ${key}  key优先寻找作用域最小的域对象存储的key值--%>
req:${k1}<br/><br/><br/><!--request-->

arr[2]: ${array[2]}<br/><br/>

arr[1] + arr[3] = ${array[1] + array[3]}<br/><br/>

null: ${empty null}<br/><br/>
<%--El内置对象,可用于获取不同关联对象数据--%>
pageContext: ${pageScope.k1}<br/><br/>
request: ${requestScope.k1}<br/><br/>
session: ${sessionScope.k1}<br/><br/>
application: ${applicationScope.k1}<br/><br/>
</body>
</html>
